using ASP;
using HoWave.Web;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.HtmlControls;
public class IMS_ad_ADShow : Page, IRequiresSessionState
{
	protected HtmlForm form1;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (base.Request.QueryString["ADID"] != null)
		{
			AdBll adBll = new AdBll();
			DataTable singeleAd = adBll.GetSingeleAd(int.Parse(base.Request.QueryString["ADID"].ToString()));
			if (singeleAd.Rows.Count > 0)
			{
				string text = singeleAd.Rows[0]["ADType"].ToString();
				if (text != null)
				{
					if (!(text == "1"))
					{
						if (!(text == "2"))
						{
							if (!(text == "3"))
							{
								if (!(text == "4"))
								{
									if (text == "5")
									{
										base.Response.Write(string.Concat(new string[]
										{
											"<iframe id='AD_",
											singeleAd.Rows[0]["adid"].ToString(),
											"' marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no width=100% height=100% src='",
											singeleAd.Rows[0]["ADIntro"].ToString(),
											"'>WAITING....</iframe>"
										}));
									}
								}
								else
								{
									base.Response.Write(singeleAd.Rows[0]["ADIntro"].ToString());
								}
							}
						}
						else
						{
							if (singeleAd.Rows[0]["FlashWmode"].ToString() == "1")
							{
								base.Response.Write(string.Concat(new string[]
								{
									"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' name='AD_",
									singeleAd.Rows[0]["adid"].ToString(),
									"' id='AD_",
									singeleAd.Rows[0]["adid"].ToString(),
									"' width='",
									singeleAd.Rows[0]["ImgWidth"].ToString(),
									"' height='",
									singeleAd.Rows[0]["ImgHeight"].ToString(),
									"'/><param name='movie' value='",
									singeleAd.Rows[0]["Imgurl"].ToString(),
									"'/><param name='wmode' value='Transparent'/><param name='quality' value='autohigh'/><embed name='AD_",
									singeleAd.Rows[0]["ADID"].ToString(),
									"' id='AD_",
									singeleAd.Rows[0]["ADID"].ToString(),
									"' width='",
									singeleAd.Rows[0]["ImgWidth"].ToString(),
									"' height='",
									singeleAd.Rows[0]["ImgHeight"].ToString(),
									"' src='",
									singeleAd.Rows[0]["imgurl"].ToString(),
									"' wmode='Transparent' quality='autohigh' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'></embed>"
								}));
							}
							else
							{
								base.Response.Write(string.Concat(new string[]
								{
									"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' name='AD_",
									singeleAd.Rows[0]["adid"].ToString(),
									"' id='AD_",
									singeleAd.Rows[0]["adid"].ToString(),
									"' width='",
									singeleAd.Rows[0]["ImgWidth"].ToString(),
									"' height='",
									singeleAd.Rows[0]["ImgHeight"].ToString(),
									"'/><param name='movie' value='",
									singeleAd.Rows[0]["Imgurl"].ToString(),
									"'/><param name='quality' value='autohigh'/><embed name='AD_",
									singeleAd.Rows[0]["ADID"].ToString(),
									"' id='AD_",
									singeleAd.Rows[0]["ADID"].ToString(),
									"' width='",
									singeleAd.Rows[0]["ImgWidth"].ToString(),
									"' height='",
									singeleAd.Rows[0]["ImgHeight"].ToString(),
									"' src='",
									singeleAd.Rows[0]["imgurl"].ToString(),
									"' quality='autohigh' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'></embed>"
								}));
							}
						}
					}
					else
					{
						if (singeleAd.Rows[0]["LinkUrl"].ToString() != "")
						{
							base.Response.Write("<a href='" + singeleAd.Rows[0]["LinkUrl"].ToString().Trim() + "'");
							if (singeleAd.Rows[0]["LinkTarget"].ToString() == "0")
							{
								base.Response.Write(" target='_self'");
							}
							else
							{
								base.Response.Write(" target='_blank'");
							}
							if (singeleAd.Rows[0]["LinkAlt"].ToString() != "")
							{
								base.Response.Write(" title='" + singeleAd.Rows[0]["LinkAlt"].ToString() + "'");
							}
							base.Response.Write(">");
						}
						base.Response.Write(string.Concat(new string[]
						{
							"<img name='AD_",
							singeleAd.Rows[0]["ADID"].ToString(),
							"' id='AD_",
							singeleAd.Rows[0]["ADID"].ToString(),
							"' src='",
							singeleAd.Rows[0]["ImgUrl"].ToString(),
							"'"
						}));
						if (singeleAd.Rows[0]["ImgWidth"].ToString() != "0")
						{
							base.Response.Write(" width='" + singeleAd.Rows[0]["ImgWidth"].ToString() + "'");
						}
						if (singeleAd.Rows[0]["ImgHeight"].ToString() != "0")
						{
							base.Response.Write(" width='" + singeleAd.Rows[0]["ImgHeight"].ToString() + "'");
						}
						base.Response.Write(" border='0'>");
						if (singeleAd.Rows[0]["LinkUrl"].ToString() != "")
						{
							base.Response.Write("</a>");
						}
					}
				}
			}
		}
	}
}
